<?php 
require_once 'sesi_login.php';
require_once 'konfigurasi.php';

fungsi('pengguna');

define('PAGE', 'Admin Latihan');
define('PAGE_ICO', 'icon-stats');
define('PAGE_URL', 'admin_latihan.php');

panggil_header();
koneksi_buka();
$text_q_soal = "select *, a.id as s_id, a.nama as s_nama, b.nama as m_nama, c.nama as k_nama
			from soal a left join materi b on a.materi = b.id 
			left join kelas c on b.tipe_kelas = c.tipe group by a.id";
$q_soal = mysql_query($text_q_soal);
?>

<div class="content">
                
	<div class="page-header">
		<div class="icon">
			<span class="ico-arrow-right"></span>
		</div> 
		<h1> Latihan<small>SDN I</small></h1>
	</div>
	
	<div class="row-fluid">
		<div class="span12">
			<div class="block">
				<div class="head purple">
					<div class="icon"><span class="ico-book-3"></span></div>
					<h2>Daftar Latihan</h2>
					<ul class="buttons">
						<li><a href="#" onClick="source('table_hover'); return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
					</ul> 
					<ul class="buttons">
						<li><a id="tambah-latihan" href="#"><div class="icon"><span class="ico-plus-sign"></span></div></a></li>
					</ul>                      
					                                                         
				</div>                
				<div class="data-fluid">
					<table cellpadding="0" cellspacing="0" width="100%" class="table fpTable lcnp">
						<thead>
							<tr>
								<th width="10%">
									Id Latihan
								</th>
								<th width="30%">
									Nama Latihan
								</th>
								<th width="20%">
									Materi
								</th>
								<th width="15%">
									Kelas
								</th>
								<th width="10%">
									Jumlah
								</th>
								<th class="TAC" width="15%">
									Operation
								</th>
							</tr>
						</thead>
						<tbody>
							<?php
								while($dt_soal = mysql_fetch_array($q_soal)){
							?>
								<tr>
									<td>
										<?php echo $dt_soal['s_id'];?>
									</td>
									<td>
										<?php echo $dt_soal['s_nama'];?>
									</td>
									<td>
										<?php echo $dt_soal['m_nama'];?>
									</td>
									<td>
										<?php echo $dt_soal['k_nama'];?>
									</td>
									<td>
										<?php echo $dt_soal['jumlah'];?>
									</td>
									<td>
										<a href="admin_latihan_detail.php?id=<?php echo $dt_soal['s_id'];?>" class="button blue">
											<div class="icon"><span class="ico-search"></span></div>
										</a>
										<a href="#" class="button green">
											<div class="icon"><span class="ico-pencil"></span></div>
										</a>
										<a href="#" class="button red">
											<div class="icon"><span class="ico-remove"></span></div>
										</a>                                              
									</td>
								</tr>
							<?php } ?>
						</tbody>
					</table>
				</div>  
				<br />
				<!--
				<div class="data-fluid">
					<div align="right">                  
						<button class="btn btn-primary" type="button">Cetak Semua</button>
					</div>   
				</div> 
				-->			 
			</div>
		</div>
	</div>
</div>

<div id="dialog-tambah-latihan" style="display:none;">
	<?php
		require_once 'modul/admin_latihan/tambah_latihan.php';
	?>
</div>

<div class="dialog" id="source" style="display: none;" title="Source"></div>

<?php
panggil_footer();
?>
